<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>基本列表</title>
  <script src="vue.js"></script>
</head>
<!--
    v-for指令：
        1.用于展示列表数据
        2.语法：v-for=“（item，index） in xxx” ：key=“yyy”
        3.可遍历：数组，对象，字符串，指定次数
-->
<body>
<div id="root">
    <ul>
        <li>List:</li>
<!--        遍历数组-->
        <li v-for="(p,index) in persons" :key="index">{{p.name}}-{{p.age}}</li>
<!--        遍历对象-->
        <li v-for="(value,k) of cars" :key="k">{{k}}-{{value}}</li>
<!--   遍历字符串-->
        <li v-for="(char,index) of str" :key="index">{{index}}-{{char}}</li>
<!--   遍历指定次数-->
        <li v-for="(number,index) of 5" :key="index">{{number}}-{{index}}</li>

    </ul>
</div>
</body>
<script type="text/javascript">
    const  vm = new Vue({
        el:"#root",
        data:{
            persons:[
                {id:'001',name:"张三",age:11},
                {id:'002',name:"张四",age:12},
                {id:'003',name:"张五",age:13},
            ],
            cars:{name:'aodi',price:11,color:'black'},
            str:"hello"
        }
    })

</script>

</html>